package com.fit.entities.shedule;

import javax.persistence.AssociationOverride;
import javax.persistence.AssociationOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.apache.tapestry5.beaneditor.NonVisual;

import com.fit.entities.coach.Coach;
import com.fit.entities.sport.Sport;
import com.fit.entities.weekdays.WeekDays;


@Entity
@Table(name="shedule")
@AssociationOverrides({
	@AssociationOverride(name = "pk.coach", joinColumns = @JoinColumn(name = "coach_jmbg")),
	@AssociationOverride(name = "pk.sport", joinColumns = @JoinColumn(name = "sport_id")),
	@AssociationOverride(name = "pk.day", joinColumns = @JoinColumn(name = "day_id"))})


public class Shedule {
	
		
@EmbeddedId
private ShedulePK pk = new ShedulePK();

@Column(name="time",nullable=false)
private String time;


public ShedulePK getPk() {
	return pk;
}

public void setPk(ShedulePK pk) {
	this.pk = pk;
}

public String getTime() {
	return time;
}

public void setTime(String time) {
	this.time = time;
}

public void setCoach(Coach coach){
	getPk().setCoach(coach);
}

@Transient
public Coach getCoach(){
	return getPk().getCoach();
}

public void setSport(Sport sport){
	getPk().setSport(sport);
}

@Transient
public Sport getSport(){
	return getPk().getSport();
}

public void setDay(WeekDays day){
	getPk().setDay(day);
}

@Transient
public WeekDays getDay(){
	return getPk().getDay();
}



public boolean equals(Object o) {
	if (this == o)
		return true;
	if (o == null || getClass() != o.getClass())
		return false;

	Shedule that = (Shedule) o;

	if (getPk() != null ? !getPk().equals(that.getPk())
			: that.getPk() != null)
		return false;

	return true;
}
	
}
